<?php
namespace app\index\controller;
use \app\index\controller\Base;
use \think\Db;
class News extends Base
{
    public function index()
    {
		$tuijian = Db::name('tuijian')->alias("t")->join([["lawyer_case l","t.lid=l.id","LEFT"]])->field(["t.id","t.lid","l.title"])->select();
        $this->assign('tuijian',$tuijian);
		$lianxiren=Db::name("lianxiren")->find();
		$this->assign("lianxiren",$lianxiren);
        $seo=Db::name("seo")->where("class","index")->find();
        $this->assign("seo",$seo);
        $news = Db::name("news")->order("id","desc")->paginate(10,false,["query"=>Request()->post()]);
        $this->assign('news',$news);
        $this->assign('page',$news->render());
    	$this->assign('menu','5');
    	$this->assign('_title','新闻列表');
        return $this->fetch();
    }

    //新闻详情页
    public function info(){
		$tuijian = Db::name('tuijian')->alias("t")->join([["lawyer_case l","t.lid=l.id","LEFT"]])->field(["t.id","t.lid","l.title"])->select();
        $this->assign('tuijian',$tuijian);
		$lianxiren=Db::name("lianxiren")->find();
		$this->assign("lianxiren",$lianxiren);
    	//新闻
        $news=Db::name('news')->where('id',$this->request->param('id'))->find();
		$seo=["title"=>$news['tit'],"key"=>$news["key"],"dec"=>$news['dec']];
		$this->assign("seo",$seo);
        $this->assign('news',$news);
		$this->assign('menu','5');
        return $this->fetch();
    }
}
